#include <stdio.h>
#include <memory.h>

/* In a chess board, each square is labeled with a letter followed by a 
 * number, e.g. A1, B3, etc. The letter labels the column, while the number
 * labels the row. Therefore the notation (A1) is in column-major order.
 *
 * Since the number of squares is <= 26, it can be shown that unless there
 * is only one square, a board with one or two rows is infeasible. Therefore
 * the number of rows is >= 3, and the number of columns is <= 8. Hence the
 * label is always of length 2. This simplifies the formatting procedure.
 */

static char visited[26][26];    /* row-major */
static int num_rows, num_cols, num_squares;
static char path[100];

typedef struct coordinate 
{
    short i, j;
} coordinate;

static const coordinate dir[8] = 
{
    { -1, -2 }, { +1, -2 }, { -2, -1 }, { +2, -1 },
    { -2, +1 }, { +2, +1 }, { -1, +2 }, { +1, +2 }
};

/* Recursively solves the problem starting from position (i,j), where
 * (i,j) is assumed to be already visited. Returns non-zero if a path
 * that visits all squares is found and stored in _path_; 0 otherwise.
 */
int solve(int i, int j, int num_visited)
{
    coordinate newpos[8];
    int k, n = 0;

    /* Check whether each new position is within bounds and unvisited. */
    for (k = 0; k < 8; k++)
    {
        int ii = i + dir[k].i, jj = j + dir[k].j;
        if (ii >= 0 && ii < num_rows && jj >= 0 && jj < num_cols 
            && !visited[ii][jj])
        {
            newpos[n].i = ii;
            newpos[n].j = jj;
            n++;
        }
    }

    /* Try each direction recursively. */
    for (k = 0; k < n; k++)
    {
        int ii = newpos[k].i, jj = newpos[k].j;
        path[num_visited*2] = 'A' + jj;
        path[num_visited*2+1] = '1' + ii;

        if (num_visited + 1 == num_squares)
            return 1;

        visited[ii][jj] = 1;
        if (solve(ii, jj, num_visited + 1))
            return 1;
        visited[ii][jj] = 0;
    }
    return 0;
}

int main()
{
    int T, t;

    scanf("%d", &T);
    for (t = 1; t <= T; t++)
    {
        scanf("%d %d", &num_rows, &num_cols);
        num_squares = num_rows * num_cols;

        memset(visited, 0, sizeof(visited));
        visited[0][0] = 1;
        path[0] = 'A';
        path[1] = '1';
        
        printf("Scenario #%d:\n", t);
        if (num_squares == 1 || solve(0, 0, 1))
        {
            path[num_squares*2] = '\0';
            printf("%s\n", path);
        }
        else
            printf("impossible\n");
        printf("\n");
    }
    return 0;
}
